package com.walsai.pcsys.web.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.mvc.SimpleFormController;

import com.walsai.pcsys.core.model.User;
import com.walsai.pcsys.core.service.UserManager;

public class ProfileController extends SimpleFormController {

	private UserManager userManager;
	
	public void setUserManager(UserManager userManager){
		this.userManager = userManager;
	}
	
	protected void doSubmitAction(Object o) throws Exception {
		User anonymous = (User) o;
		this.userManager.save(anonymous);
		System.out.println("------------------------------------------aqui----------------");
	}
	
	protected Object formBackingObject(HttpServletRequest request) throws ServletException {
		return (User)request.getSession().getAttribute("userInfo");
	}
}
